package com.mmy.study.common;

import lombok.Data;

import java.io.Serializable;
@Data
public class Result implements Serializable{
    private static final long serialVersionUID = 1L;
    private boolean success;
    private int code;
    private String message;
    private Object data;

    public Result(boolean success, int code, String message, Object data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static Result succ(Object data, String message) {
        return new Result(true, 200, message, data);
    }
    // 返回码表示为错误
    public static Result fail(Object data, String message) {
        return new Result(false, 400, message, data);
    }
}
